package com.onluy.frameworkcloud.base;

import com.onluy.frameworkcloud.Param.ParamPagination;
import com.onluy.frameworkcloud.data.bean.Pagination;
import com.onluy.frameworkcloud.data.util.InParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public   class AppWalkController<T>  {
    protected Logger log =   LoggerFactory.getLogger(this.getClass());


    public  void  FormatCondition(InParam<String,Object> inParam, T t){


    }



    public Pagination FormatPagination(ParamPagination paramPagination ){
        Pagination pagination= new  Pagination();
        int pageSize =paramPagination.getPageSize();
        int currPage = paramPagination.getCurrPage();
        int start = (currPage - 1) * pageSize;
        start = start < 0 ? 0 : start;
        pagination.setRange(start, pageSize);
        pagination.setCurrPage(currPage);
        return  pagination;
    }

}
